<template>
	<view class="learn">
		<u-navbar title="测试记录" @rightClick="rightClick" :autoBack="true">
			<view slot="right" @click="handleDel"><u-icon name="home" size="20"></u-icon></view>
		</u-navbar>
		<view class="main-content">
			<u-checkbox-group v-if="dataList.length > 0" v-model="checkboxValue1" placement="column">
				<view class="list">
					<view class="item" v-for="(item,index) in dataList" :key="index">
						<u-checkbox :name="item.id" v-if="showDel"> </u-checkbox>
						<img :src="item.img" alt="" class="img" />
						<view class="">
							<view class="title"> 真题考试券 <text>56</text> </view>
							<view class="time"> 2025-05-24 12：21：22 </view>
						</view>
						<view class="more">
							<img src="@/static/img/more.png" alt="" />
						</view>
					</view>
				</view>
			</u-checkbox-group>
			<img v-else src="@/static/img/empty.png" alt="" style="width: 100%;margin-top: 20vh;" />
		</view>
		<u-button class="opt-btn del" type="primary" v-if="showDel" text="删除" @click="confirmDel"></u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [{
						id: 1,
						img: require('@/static/img/fail.png'),
						title: '真题考试券',
						num: '69'
					},
					{
						id: 2,
						img: require('@/static/img/pass.png'),
						title: '真题考试券',
						num: '69'
					},
				],
				checkboxValue1: [],
				showDel: false
			}
		},
		methods: {
			handleDel() {
				this.showDel = true
			},
			confirmDel(){
				this.showDel = false
			}
		}
	}
</script>

<style scoped lang="less">
	view {
		box-sizing: border-box;
	}

	.learn {
		background-color: #F3F5F8;
		min-height: 100vh;
		padding-top: 100rpx;
	}

	.main-content {
		padding: 20rpx 32rpx;

		.list {
			display: flex;
			gap: 32rpx 24rpx;
			flex-direction: column;
			margin-top: 28rpx;
			gap: 20rpx;

			.item {
				display: flex;
				height: 164rpx;
				background: #FFFFFF;
				border-radius: 16rpx;
				padding: 32rpx;
				gap: 20rpx;
				position: relative;

				.img {
					width: 100rpx;
					height: 100rpx;
				}

				.title {
					font-weight: 400;
					font-size: 36rpx;
					color: #263459;
					line-height: 1;
				}

				.time {
					margin-top: 20rpx;
					font-weight: 400;
					font-size: 22rpx;
					color: #666666;
					line-height: 36rpx;
					text-align: left;
				}

				.more {
					position: absolute;
					right: 32rpx;
					top: 50%;
					transform: translateY(-50%);
					width: 24rpx;
					height: 24rpx;
					display: flex;

					img {
						width: 100%;
					}
				}
			}
		}
	}
	.del {
		width: 428rpx;
		height: 76rpx;
		background: linear-gradient( 270deg, #1B5FF3 0%, #55B1F4 100%), #D9D9D9;
		border-radius: 14rpx 14rpx 14rpx 14rpx;
		border: none;
		position: fixed;
		bottom: 32rpx;
		left: 50%;
		transform: translateX(-50%);
	}
</style>